package com.oristand.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类,配置了时区,mybatis-plus的分页插件
 *
 * @author shiyjian
 * @version 1.0
 * @date 2021/12/1 12:58
 */
@Configuration
public class OristandConfig {
    public static final String TIMEZONE = "GMT+8";
    public static final String LOCALE = "zh";

    /**
     * 注册了这个Bean,Page这个类才能用
     *
     * @return mybatis-plus的分页插件
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
